package com.itheima.ArrayList;

import com.itheima.ArrayList.domain.Student;

import java.util.ArrayList;

public class Demo3 {
    public static void main(String[] args) {
        //1.创建Student对象集合
        ArrayList<Student> list=new ArrayList<>();
        //2.创建学生对象
        Student stu1= new Student("张三",34);
        Student stu2= new Student("李四",23);
        Student stu3= new Student("旺旺",45);
        //3.添加学生对象进集合
        list.add(stu1);
        list.add(stu2);
        list.add(stu3);
        //4.遍历打印
        for (int i = 0; i <list.size() ; i++) {
            Student stu =list.get(i);
            System.out.println(stu.getName()+"..."+stu.getAge());
        }

    }
}
